package games.isoMatric.data
{
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.IEventDispatcher;
	
	public class GameData extends EventDispatcher
	{
		public static const WIDTH_CHANGE:String = "width change";
		public static const HEIGHT_CHANGE:String = "height change";
		public static const CELLSIZE_CHANGE:String = "cell change";
		public static const COLUMN_CHANGE:String = "column change";
		public static const ROW_CHANGE:String = "row change";
		public static const BOXSNUM_CHNAGE:String = "box num change";
		public static const EDITMODE_CHANGE:String = "edit mode change";
		private var m_width:int = 800;
		private var m_height:int = 600;
		private var m_cell:int = 20;
		private var m_columns:int = 20;			// 栅格列数 y轴方向（向左延展）
		private var m_rows:int = 20;			// 栅格行数x轴方向（向右延展）
		private var m_totalBoxs:int = 15;		// 生成盒子数
		private var m_editMode:Boolean = false; // 是否编辑状态
		
		public function GameData(target:IEventDispatcher=null)
		{
			super(target);
		}
		
		public function set width(n:int):void
		{
			if(m_width == n)return;
			m_width = n;
			dispatchEvent(new Event(WIDTH_CHANGE));
		}
		
		public function get width():int 
		{
			return m_width;
		}
		
		public function set height(n:int):void
		{
			if(m_height == n)return;
			m_height = n;
			dispatchEvent(new Event(HEIGHT_CHANGE));
		}
		
		public function get height():int
		{
			return m_height;
		}
		
		public function set cellSize(n:int):void
		{
			if(m_cell == n)return;
			m_cell = n;
			dispatchEvent(new Event(CELLSIZE_CHANGE));
		}
		
		public function get cellSize():int
		{
			return m_cell;
		}
		
		public function set columns(n:int):void
		{
			if(m_columns == n)return;
			m_columns = n;
			dispatchEvent(new Event(COLUMN_CHANGE));
		}
		
		public function get columns():int 
		{
			return m_columns;
		}
		
		public function set rows(n:int):void
		{
			if(m_rows == n)return;
			m_rows = n;
			dispatchEvent(new Event(ROW_CHANGE));
		}
		
		public function get rows():int
		{
			return m_rows;
		}
		
		public function set totalBoxs(n:int ):void
		{
			if(m_totalBoxs == n)return;
			m_totalBoxs = n;
			dispatchEvent(new Event(BOXSNUM_CHNAGE));
		}
		
		public function get totalBoxs():int
		{
			return m_totalBoxs;
		}
		
		public function set editMode(b:Boolean):void
		{
			if(m_editMode == b)return;
			m_editMode = b;
			dispatchEvent(new Event(EDITMODE_CHANGE));
		}
		
		public function get editMode():Boolean
		{
			return m_editMode;
		}
	}
}